﻿@using ZX.Tools
@using ZX.Model
@model  Temporary_Task_Block
@{
    ViewBag.Title = "编辑区块-指效OA";
}
<link type="text/css" rel="stylesheet" href="/Static/styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="~/Static/css/theme/default/style.css" />
<link href="~/Static/styles/theme/zui/css/min.css" rel="stylesheet" />
<link href="~/Static/js/Validform/css/style.css" rel="stylesheet" />
<link href="~/Static/js/jquery/chosen/chosen.min.css" rel="stylesheet" />
<link href="~/Static/js/layui/css/layui.css" rel="stylesheet" />
<link href="~/Static/js/layer/need/layer.css" rel="stylesheet" />
<script src="/Static/js/jquery/jquery-1.11.1.min.js"></script>
<script src="~/Static/js/jquery/form/min.js"></script>
<script src="~/Static/js/Validform/js/Validform_v5.3.2_min.js"></script>
<script src="~/Static/js/jquery/chosen/chosen.min.js"></script>
<script src="~/Static/js/zui/zui.min.js"></script>
<script src="~/Static/js/layui/layui.js"></script>
<script src="~/Static/js/layer/layer.js"></script>
<script src="~/Static/js/layer/layer.tools.js"></script>
<style>
    .col-sm-2{
        width:14%;
    }
</style>
<form method="post" class="form-horizontal" id="formTemporary_Task_Block" action="/Temporary_Task_Block/SaveData">

    <input type="hidden" name="Id" id="Id" value="@Model.Id" />
    <input type="hidden" name="aMid" id="aMid" value="@ViewBag.CurrentMid" />
    <input type="hidden" id="secondMenuId" name="secondMenuId" value="@ViewBag.SecondMenuId" />

    <div class="form-group" style="padding-top:18px;">
        <label for="BName" class="col-sm-2">
            区块名称
        </label>
        <div class="col-md-6 col-sm-10">
            <input type="text" id="BName" name="BName" value="@Model.BName" placeholder="区块名称" class="form-control" autocomplete="off" datatype="*">
        </div>
    </div>
    <div id="div_PTType" class="form-group">
        <label for="PTType" class="col-sm-2">
            类型
        </label>
        <div class="col-md-6 col-sm-10">
            <select name="TType" id="TType" class="form-control">
                <option value="1" @(Model.TType == 1 ? "selected" : "")>指派给我</option>
                <option value="2" @(Model.TType == 2 ? "selected" : "")>由我创建</option>
                <option value="3" @(Model.TType == 3 ? "selected" : "")>由我完成</option>
                <option value="4" @(Model.TType == 4 ? "selected" : "")>由我关闭</option>
                <option value="5" @(Model.TType == 5 ? "selected" : "")>由我取消</option>
            </select>
            <select name="params[type]" id="paramstype" class="form-control chosen" style="display: none;">
                <option value="assignedTo" data-keys="zhipaigeiwo zpgw">指派给我</option>
                <option value="createdBy" data-keys="youwochuangjian ywcj">由我创建</option>
                <option value="finishedBy" data-keys="youwowancheng ywwc">由我完成</option>
                <option value="closedBy" data-keys="youwoguanbi ywgb">由我关闭</option>
                <option value="canceledBy" data-keys="youwoquxiao ywqx">由我取消</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="RowCounts" class="col-sm-2">
            数量
        </label>
        <div class="col-md-6 col-sm-10">
            <input type="text" id="RowCounts" name="RowCounts" class="form-control" value="@Model.RowCounts" placeholder="数量,系统默认3" onkeypress="$.admin.keyPress(this)"
                   onkeyup="$.admin.keyUp(this)"
                   onblur="$.admin.keyBlur(this)">
        </div>
    </div>
    <div id="div_BOrderBy" class="form-group">
        <label for="BOrderBy" class="col-sm-2">
            排序
        </label>
        <div class="col-md-6 col-sm-10">
            <select name="BOrderBy" id="BOrderBy" class="form-control">
                <option value="id_asc" @(Model.BOrderBy == "id_asc" ? "selected" : "")>ID 递增</option>
                <option value="id_desc" @(Model.BOrderBy == "id_desc" ? "selected" : "")>ID 递减</option>
                <option value="pri_asc" @(Model.BOrderBy == "pri_asc" ? "selected" : "")>优先级递增</option>
                <option value="pri_desc" @(Model.BOrderBy == "pri_desc" ? "selected" : "")>优先级递减</option>
                <option value="deadline_asc" @(Model.BOrderBy == "deadline_asc" ? "selected" : "")>截止日期递增</option>
                <option value="deadline_desc" @(Model.BOrderBy == "deadline_desc" ? "selected" : "")>截止日期递减</option>
            </select>
        </div>
    </div>
    <div id="div_PTState" class="form-group">
        <label for="PTState" class="col-sm-2">
            任务状态
        </label>
        <input type="hidden" id="TState" name="TState" class="form-control" value="@Model.TState" placeholder="任务状态">
        <div class="col-md-6 col-sm-10">
            <select data-placeholder="选择状态..." class="chosen-select form-control" tabindex="2" multiple="">
                @{
                    List<string> selectState = new List<string>();
                    if (Model.TState.IsNullOrEmpty())
                    {
                        selectState.Add("");
                    }
                    else
                    {
                        selectState = Model.TState.Split(',').ToList();
                    }

                    if (selectState.Contains("1"))
                    {
                        <option value="1" data-keys="weiwancheng wwc" selected>未完成</option>
                    }
                    else
                    {
                        <option value="1" data-keys="weiwancheng wwc">未完成</option>
                    }
                    if (selectState.Contains("2"))
                    {
                        <option value="2" data-keys="weikaishi wks" selected>未开始</option>
                    }
                    else
                    {
                        <option value="2" data-keys="weikaishi wks">未开始</option>
                    }
                    if (selectState.Contains("3"))
                    {
                        <option value="3" data-keys="jinxingzhong jxz" selected>进行中</option>
                    }
                    else
                    {
                        <option value="3" data-keys="jinxingzhong jxz">进行中</option>
                    }
                    if (selectState.Contains("4"))
                    {
                        <option value="4" data-keys="yiwancheng ywc" selected>已完成</option>
                    }
                    else
                    {
                        <option value="4" data-keys="yiwancheng ywc">已完成</option>
                    }
                    if (selectState.Contains("5"))
                    {
                        <option value="5" data-keys="yiquxiao yqx" selected>已取消</option>
                    }
                    else
                    {
                        <option value="5" data-keys="yiquxiao yqx">已取消</option>
                    }
                    if (selectState.Contains("6"))
                    {
                        <option value="6" data-keys="yiguanbi ygb" selected>已关闭</option>
                    }
                    else
                    {
                        <option value="6" data-keys="yiguanbi ygb">已关闭</option>
                    }
                }

            </select>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            @Html.Raw(ViewBag.CurrentBtnList29)
        </div>
    </div>

</form>
<script type="text/javascript">

    $('select.chosen-select').chosen({
        no_results_text: '没有找到',    // 当检索时没有找到匹配项时显示的提示文本
        disable_search_threshold: 10, // 10 个以下的选择项则不显示检索框
        search_contains: true         // 从任意位置开始检索
    });

    $('select.chosen-select').on('change', function () {
        // 用户改变了选择
        $("#TState").val($(this).val());

    });

    function saveData() {
        $("#formTemporary_Task_Block").submit();
    }
    $("#formTemporary_Task_Block").Validform({
        tiptype: 3,
        callback: function (form) {
            $("#formTemporary_Task_Block").ajaxSubmit(function (data) {
                if (data.Code == 300) {
                    win.alert("保存失败");
                } else if (data.Code == 200) {
                    win.success("保存成功", function () {
                        win.close();
                        //goProject_Task($("#FK_ProjectId").val());
                    });
                }
            });
            return false;
        }
    });
</script>
